package com.lj.api.common;

public class CodeMsg {
    private int retCode;
    private String message;
    // 按照模块定义CodeMsg
    /**
     * retcode 0-200 接口能正常使用，但业务异常
     * 500---600 开发的 表示系统错误
     */

    // 系统并发限流，或者 乐观锁更新操作失败等
    public static CodeMsg SYS_BUSY= new CodeMsg(-100,"系统繁忙，请稍后再试试!");

    //接口参数错误
    public static CodeMsg ILLEGAL_REQUEST = new CodeMsg(-1,"非法请求");
    public static CodeMsg PARAMETER_ISNULL = new CodeMsg(-2,"缺少参数");
    public static CodeMsg ILLEGAL_PARAMS= new CodeMsg(-10,"无效参数");

    //授权 token 异常
    public static CodeMsg ILLEGAL_JTW = new CodeMsg(-3,"无效token");
    public static CodeMsg OUTOFDATE_JTW = new CodeMsg(-4,"token已超时");
    public static CodeMsg NO_ACCESS_AUTH = new CodeMsg(-5,"无操作权限");

    //成功反馈信息
    public static CodeMsg SUCCESS = new CodeMsg(1,"success");
    //业务错误
    public static CodeMsg LOGIN_FAILD = new CodeMsg(100001,"用户名或密码错误");
    public static CodeMsg LOGIN_DISABLE = new CodeMsg(100002,"账号已禁用");
    public static CodeMsg ILLEGAL_SMS_REQUEST = new CodeMsg(100003,"无权访问");
    public static CodeMsg ILLEGAL_CODE = new CodeMsg(100004,"无效验证码");
    public static CodeMsg EXIST_PHONE = new CodeMsg(100005,"手机号已存在");

    //业务错误  -- 商品
    public static CodeMsg OFF_SHELF = new CodeMsg(101000,"商品已下架！");
    public static CodeMsg OUT_OF_STOCK = new CodeMsg(101001,"商品库存不足！");
    public static CodeMsg NOT_ISEXIT = new CodeMsg(101002,"商品不存在！");
    public static CodeMsg PRICE_IS_CHANGED = new CodeMsg(101003,"商品价格已发生变化！请刷新页面再试试");
    //上传token，未匹配到method
    public static CodeMsg UP_TOEKN_MARCH = new CodeMsg(200001,"未匹配到method");

    // 系统错误
    public static CodeMsg SERVER_EXCEPTION = new CodeMsg(500000,"服务端异常");
    public static CodeMsg USER_NOT_EXSIST = new CodeMsg(500102,"用户不存在");
    public static CodeMsg ONLINE_USER_OVER = new CodeMsg(500103,"在线用户数超出允许登录的最大用户限制。");
    public static CodeMsg SESSION_NOT_EXSIST =  new CodeMsg(500104,"不存在离线session数据");
    public static CodeMsg NOT_FIND_DATA = new CodeMsg(500105,"查找不到对应数据");


    private CodeMsg(int retCode, String message) {
        this.retCode = retCode;
        this.message = message;
    }
    public int getRetCode() {
        return retCode;
    }
    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }
}
